import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from "axios"
import XLSX from 'xlsx';

import SockJS from 'sockjs-client';
import Stomp from "stompjs"


import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
// 引入组件
// import 自定义组件对象名 from "./components/组件.vue"

Vue.config.productionTip = false
// 将引入组件转为全局组件-(可在项目中任一组件的html中用全局组件标签)
// Vue.component("标签名",自定义组件对象名)

//配置axios
// axios.defaults.baseURL="https://ceshi2.cklock.cn"
axios.defaults.baseURL="https://jbhotel.cklock.cn"
//axios.defaults.headers.post['content-Type'] = 'application/json;charset=UTF-8'
Vue.prototype.axios=axios

router.beforeEach((to,from,next)=>{
  if(to.meta.requireAuth){
    console.log(to.meta.requireAuth)
    console.log(store.state.islogin)
    if(store.state.islogin){
      next()
    }else{
      next({path:'/'})
    }
  }else{next()}
})


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
